#include <iostream>

using namespace std;

class Test
{
public:
    // Test()
    // {

    // }

    Test(int a, int b, int c) : m_a(a), m_b(b), m_c(c)
    {
        cout << "Test" << endl;
    }

    Test(const Test &other)
    {
        m_a = other.m_a;
        m_b = other.m_b;
        m_c = other.m_c;

        cout << "Test copy" << endl;
    }

    void A()
    {
        cout << m_a << endl;
    }

    void printInfo()
    {
        cout << "I am Test!" << endl;
    }
    int m_a;

    ~Test()
    {
        cout << "~Test" << endl;
    }
protected:
    void B()
    {
        cout << m_b << endl;
    }
    int m_b;
private:
    void C()
    {
        cout << m_c << endl;
    }
    int m_c;
};

class Base
{
public:
    Base()
    {
        cout << "Base" << endl;
    }
};

class AA
{
public:
    // AA()
    // {
    //     cout << "A" << endl;
    // }

    AA(int a) : m_a(a)
    {
        cout << "AA" << endl;
    }

    int m_a;
};

class TestA : public Base, public Test
{
public:
    using Test::m_a;
    using Test::A;
    
    //隐藏规则：默认生成（前提：基类必须要有默认构造函数）
    // TestA() : Test()   //派生类继承的属性的初始化，需要通过基类构造函数进行初始化
    // {

    // }

    TestA(const TestA &other) : Test(other), a(1)
    {
        cout << "TestA copy" << endl;
    }

    TestA(int a, int b) : Test(a,b,0), a(2)
    {
        cout << "TestA" << endl;
    }
    void print()
    {
        cout << m_a << endl;
        cout << m_b << endl;
        //cout << m_c << endl;
    }

    void printInfo()
    {
        cout << "I am TestA" << endl;
    }

    ~TestA()
    {
        cout << "~TestA" << endl;
    }
    int m_d;

    AA a;
};

int main(int agrc, char **argv)
{
    Test t(1,2,3);
    t.m_a = 1;

    TestA ta(4,5);
    ta.TestA::printInfo();
    t = ta;//默认支持：向上类型转型
    cout << "t.m_a = " << t.m_a << endl;
    //ta = t;//向下类型转型
    
    cout << sizeof(ta) << endl; 

    cout << ta.m_a << endl;
   //cout << ta.m_b << endl;

    ta.A();

    //TestA tb = ta;

    
    return 0;
}